package gek.uni.aspirant.ocl.parser.mptree.tree;

import java.util.Set;

public class NodeWithType extends Node {

    private String valueClassName;

    public NodeWithType(String name, String valueClassName) {
        super(name);
        this.valueClassName = valueClassName;
    }

    public NodeWithType(String name, Set<INode> children, String valueClassName) {
        super(name, children);
        this.valueClassName = valueClassName;
    }

    public String getValueClassName() {
        return valueClassName;
    }

    public void setValueClassName(String valueClassName) {
        this.valueClassName = valueClassName;
    }

    @Override
    protected String getShortName() {
        StringBuilder bldr = new StringBuilder(getName());
        bldr.append(":");
        String[] splits = valueClassName.split("\\.");
        if (splits.length > 0)
            bldr.append(splits[splits.length-1]);
        return bldr.toString();
    }
}